package com.example.xsssglxt.mapper;

import com.example.xsssglxt.entity.DomiteryManage;
import com.example.xsssglxt.entity.Louyu;
import com.example.xsssglxt.entity.Student;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface LouyuMapper {
    @Select("select * from louyu where name like concat ('%',#{name},'%') limit #{pageNum}, #{pageSize}")
    @Results(value =  {
            @Result(column = "create_time", property = "create_time", javaType = LocalDateTime.class, jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "update_time", property = "update_time", javaType = LocalDateTime.class, jdbcType = JdbcType.TIMESTAMP)
    })
    List<Louyu> selectpage(Integer pageNum, Integer pageSize, String name);
    @Select("select count(*) from louyu where name like concat ('%',#{name},'%')")
    Integer selecttotal(String name);
    @Select("select * from louyu")
    @Results(value =  {
            @Result(column = "create_time", property = "create_time", javaType = LocalDateTime.class, jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "update_time", property = "update_time", javaType = LocalDateTime.class, jdbcType = JdbcType.TIMESTAMP)
    })
    List<Louyu> selectlist();
    @Insert("insert into louyu(name,location,domitoryid,domitoryname,domitorynumber) VALUES(#{name},#{location},#{domitoryid},#{domitoryname},#{domitorynumber})")
    int insert(Louyu louyu);
    @Update("update louyu set name=#{name},location=#{location},domitoryid=#{domitoryid},domitoryname=#{domitoryname},domitorynumber=#{domitorynumber} where id=#{id}")
    int update(Louyu louyu);
    @Delete("delete from louyu where id=#{id}")
    int deleter(@Param("id") Integer id);
}
